package com.vincent.sms;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;
import android.widget.Toast;

/**
 * projectName:          Sms
 * packageName:          com.vincent.sms
 * className:            SmsSentReceiver
 * author:               Luoxiang
 * time:                 2025/6/30	8:46
 * desc:                 TODO
 * <p>
 * svnVersion:
 * upDateAuthor:         a
 * upDate:               2025/6/30
 * upDateDesc:           TODO
 */
public class SmsSentReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        switch (getResultCode()) {
            case Activity.RESULT_OK:
                Toast.makeText(context, "短信发送成功", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                Toast.makeText(context, "发送失败", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_NO_SERVICE:
                Toast.makeText(context, "无服务", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_NULL_PDU:
                Toast.makeText(context, "PDU错误", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_RADIO_OFF:
                Toast.makeText(context, "无线电关闭", Toast.LENGTH_SHORT).show();
                break;
        }
    }
}